import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;


public class subSet {

	
	private Set<Integer> set;

	public subSet() {
		this.set=new HashSet<Integer>();
	}
	
	public Iterator<Integer> iter(){
		return set.iterator();
	}
	
	public boolean isIn(List<subSet> l){
		int temp=0;
		for (subSet s : l) {
			if(s.size()!=this.size())
				continue;
			for (Integer i : set) {
				if(!s.includes(i))
					temp=3;
			}
			if(temp==0)
				return true;
			temp=0;
		}
		
		return false;
	}

	public subSet(int i, int sizeOfGroup) {
		this.set=new HashSet<Integer>();
		for (int j = i; j <= sizeOfGroup; j++) {
			set.add(j);
		}
	}

	public subSet add(int i) {
		subSet toRet=new subSet();
		toRet.set.addAll(this.set);
		toRet.set.add(i);
		return toRet;
	}
	
	public void add_n_keep(int i){
		if(!this.includes(i))
			set.add(i);
	}

	public boolean includes(int h) {
		for (Integer i : set) {
			if(h==i.intValue())
				return true;
		}
		return false;
	}

	public void print() {
		for (Integer num : set){
			System.out.print(num+ " ");
		}
		
	}

	public double size() {
		return set.size();
	}

	public int getLow() {
		int i=Integer.MAX_VALUE;
		for (int j : set) {
			if(j<i)
				i=j;
		}
		return i;
	}

	public int getHigh() {
		int i=Integer.MIN_VALUE;
		for (int j : set) {
			if(j>i)
				i=j;
		}
		return i;
	}
}
